package com.wuhao.shootclient.util;

import com.wuhao.shootclient.bean.ShootFireVo;

public class RectInfo {
    private double x1, y1, x2, y2;
    private double width;
    private double height;
    private double centreX;
    private double centreY;

    public RectInfo(double x1, double y1, double x2, double y2) {
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
        this.centreX = (x1 + x2) / 2;
        this.centreY= (y1 + y2) / 2;
        this.width = x2 - x1;
        this.height = y2 - y1;

    }

    public static RectInfo create(double x1, double y1, double x2, double y2) {
        return new RectInfo(x1, y1,x2,  y2);
    }

    /**
     * 获取中心
     *
     * @return PodoubleI
     */
    /**
     * 获取中心
     *
     * @return PodoubleI
     */
    public ShootFireVo getCenter() {
        return new ShootFireVo((int) Math.round(centreX), (int) Math.round(centreY));
    }
    public ShootFireVo getNewCenter() {
        return new ShootFireVo((int) Math.round(centreX), (int) Math.round(centreY));
    }
}
